home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRIC
/
DSPICE0S.ZIP
/
trunc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-22
|
7KB
|
264 lines
/* trunc.f -- translated by f2c (version of 3 February 1990 3:36:42).
You must link the resulting object file with the libraries:
-lF77 -lI77 -lm -lc (in that order)
*/
#include "f2c.h"
/* Common Block Declarations */
struct {
integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt,
nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
} cirdat_;
#define cirdat_1 cirdat_
struct {
doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu,
sfactr;
integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno,
itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
} status_;
#define status_1 status_
struct {
integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod,
lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
} flags_;
#define flags_1 flags_
struct {
doublereal tstep, tstop, tstart, delmax, tdmax, forfre;
integer jtrflg;
} tran_;
#define tran_1 tran_
struct {
doublereal value[200000];
} blank_;
#define blank_1 blank_
/*< subroutine trunc(delnew) >*/
/* Subroutine */ int trunc_(delnew)
doublereal *delnew;
{
/* System generated locals */
integer i_1;
doublereal d_1;
/* Local variables */
static integer loct;
extern /* Subroutine */ int terr_();
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
static integer loc;
/*< implicit double precision (a-h,o-z) >*/
/* this routine determines the new transient stepsize by either */
/* calling terr to estimate the local truncation error, or by checking */
/* on the number of iterations needed to converge at the last timepoint.
*/
/* spice version 2g.6 sccsid=cirdat 3/15/83 */
/*< common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
/*< 1 nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
/* spice version 2g.6 sccsid=status 3/15/83 */
/*< common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
/*< 1 xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
/*< 2 iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
/* spice version 2g.6 sccsid=flags 3/15/83 */
/*< common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
/*< 1 lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
/* spice version 2g.6 sccsid=tran 3/15/83 */
/*< common /tran/ tstep,tstop,tstart,delmax,tdmax,forfre,jtrflg >*/
/* spice version 2g.6 sccsid=blank 3/15/83 */
/*< common /blank/ value(200000) >*/
/*< integer nodplc(64) >*/
/*< complex cvalue(32) >*/
/*< equivalence (value(1),nodplc(1),cvalue(1)) >*/
/*< if (lvltim.ne.0) go to 5 >*/
if (flags_1.lvltim != 0) {
goto L5;
}
/*< delnew=dmin1(tstep,delmax) >*/
*delnew = min(tran_1.tstep,tran_1.delmax);
/*< return >*/
return 0;
/*< 5 if (lvltim.ne.1) go to 10 >*/
L5:
if (flags_1.lvltim != 1) {
goto L10;
}
/*< delnew=delta >*/
*delnew = status_1.delta;
/*< if (iterno.gt.itl3) return >*/
if (status_1.iterno > flags_1.itl3) {
return 0;
}
/*< delnew=dmin1(2.0d0*delta,tstep,delmax) >*/
/* Computing MAX */
d_1 = status_1.delta * 2., d_1 = min(tran_1.tstep,d_1);
*delnew = min(tran_1.delmax,d_1);
/*< return >*/
return 0;
/* capacitors */
/*< 10 delnew=1.0d20 >*/
L10:
*delnew = 1e20;
/*< loc=locate(2) >*/
loc = cirdat_1.locate[1];
/*< 20 if ((loc.eq.0).or.(nodplc(loc+12).ne.0)) go to 30 >*/
L20:
if (loc == 0 || nodplc[loc + 11] != 0) {
goto L30;
}
/*< loct=nodplc(loc+8) >*/
loct = nodplc[loc + 7];
/*< call terr(loct,delnew) >*/
terr_(&loct, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 20 >*/
goto L20;
/* inductors */
/*< 30 loc=locate(3) >*/
L30:
loc = cirdat_1.locate[2];
/*< 40 if ((loc.eq.0).or.(nodplc(loc+14).ne.0)) go to 50 >*/
L40:
if (loc == 0 || nodplc[loc + 13] != 0) {
goto L50;
}
/*< loct=nodplc(loc+11) >*/
loct = nodplc[loc + 10];
/*< call terr(loct,delnew) >*/
terr_(&loct, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 40 >*/
goto L40;
/* diodes */
/*< 50 loc=locate(11) >*/
L50:
loc = cirdat_1.locate[10];
/*< 60 if ((loc.eq.0).or.(nodplc(loc+16).ne.0)) go to 70 >*/
L60:
if (loc == 0 || nodplc[loc + 15] != 0) {
goto L70;
}
/*< loct=nodplc(loc+11) >*/
loct = nodplc[loc + 10];
/*< call terr(loct+3,delnew) >*/
i_1 = loct + 3;
terr_(&i_1, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 60 >*/
goto L60;
/* bjts */
/*< 70 loc=locate(12) >*/
L70:
loc = cirdat_1.locate[11];
/*< 80 if ((loc.eq.0).or.(nodplc(loc+36).ne.0)) go to 90 >*/
L80:
if (loc == 0 || nodplc[loc + 35] != 0) {
goto L90;
}
/*< loct=nodplc(loc+22) >*/
loct = nodplc[loc + 21];
/*< call terr(loct+8,delnew) >*/
i_1 = loct + 8;
terr_(&i_1, delnew);
/*< call terr(loct+10,delnew) >*/
i_1 = loct + 10;
terr_(&i_1, delnew);
/*< call terr(loct+12,delnew) >*/
i_1 = loct + 12;
terr_(&i_1, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 80 >*/
goto L80;
/* jfets */
/*< 90 loc=locate(13) >*/
L90:
loc = cirdat_1.locate[12];
/*< 100 if ((loc.eq.0).or.(nodplc(loc+25).ne.0)) go to 110 >*/
L100:
if (loc == 0 || nodplc[loc + 24] != 0) {
goto L110;
}
/*< loct=nodplc(loc+19) >*/
loct = nodplc[loc + 18];
/*< call terr(loct+9,delnew) >*/
i_1 = loct + 9;
terr_(&i_1, delnew);
/*< call terr(loct+11,delnew) >*/
i_1 = loct + 11;
terr_(&i_1, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 100 >*/
goto L100;
/* mosfets */
/*< 110 loc=locate(14) >*/
L110:
loc = cirdat_1.locate[13];
/*< 120 if ((loc.eq.0).or.(nodplc(loc+33).ne.0)) go to 200 >*/
L120:
if (loc == 0 || nodplc[loc + 32] != 0) {
goto L200;
}
/*< loct=nodplc(loc+26) >*/
loct = nodplc[loc + 25];
/*< call terr(loct+12,delnew) >*/
i_1 = loct + 12;
terr_(&i_1, delnew);
/*< call terr(loct+14,delnew) >*/
i_1 = loct + 14;
terr_(&i_1, delnew);
/*< call terr(loct+16,delnew) >*/
i_1 = loct + 16;
terr_(&i_1, delnew);
/*< loc=nodplc(loc) >*/
loc = nodplc[loc - 1];
/*< go to 120 >*/
goto L120;
/* delta is allowed only to double at each timepoint */
/*< 200 delnew=dmin1(2.0d0*delta,delnew,delmax) >*/
L200:
/* Computing MAX */
d_1 = status_1.delta * 2., d_1 = min(*delnew,d_1);
*delnew = min(tran_1.delmax,d_1);
/*< return >*/
return 0;
/*< end >*/
} /* trunc_ */
#undef cvalue
#undef nodplc